<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- Tell the browser to be responsive to screen width -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- Favicon icon -->
    <link rel="icon" type="image/png" sizes="16x16" href="assets/images/favicon.png">
    <title></title>
    <!-- Bootstrap Core CSS -->
    <link href="assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <!-- Custom CSS -->
    <link href="css/style.css" rel="stylesheet">
    <!-- You can change the theme colors from here -->
    <link href="css/colors/blue.css" id="theme" rel="stylesheet">
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
  <script src="js/jquery.js"></script>
  <script>
      function GetQueryString(account){
                      var reg = new RegExp("(^|&)"+ account +"=([^&]*)(&|$)");
                      var r = window.location.search.substr(1).match(reg);
                       if(r!=null)return  unescape(r[2]); return null;
      }
      var account = GetQueryString("account");
      function email_return(account,book_name){
            var r = confirm("确定发送邮件提醒该用户还书?");
            if(r == true){
             
             var json = {"account":account,"book_name":book_name};
             
             $.ajax({
                 type:'post',
                 url:"http://127.0.0.1:8080/email_return",
                 data: json,
                 contentType: "application/x-www-form-urlencoded",  
                  success:function(){
                 
                         alert("发送成功")
                      },
                      erroe: function(){
                          alert("发送失败！");
                      }
             })   
                
            } 
      }
      function quit(){
          var r = confirm('确定注销?');
          if(r == true){
              window.location.href='http://127.0.0.1:8848/t/moban453/index.html';
          }
      }
  
$(function(){
    var json = {"account":account};
      $.ajax({
          type:'post',
          url:"http://127.0.0.1:8080/detailInfo",
          data: json,
          dataType: 'json',
          contentType: "application/x-www-form-urlencoded", 
          success:function(data){
       
              // console.log(data.list)
              $('#account1').attr("value",data.user.username);
              $('#password1').attr("value",data.user.password);
              $('#email1').attr("value",data.user.email);
              $('#username1').attr("value",data.user.name);
              $('#phone1').attr("value",data.user.phone);       
              for(var i=0;i<data.list.length;i++){
                  $("#table1").append("<tr><td>"+data.list[i].book_name+"</td><td>"+data.list[i].date_borrow+"</td><td>"+data.list[i].date_return+"</td><td><a href=# onclick=email_return(\""+data.user.username+"\",\""+data.list[i].book_name+"\")>提醒</a></td></tr>")
              }
              }  
      })
   
      
      $('#updata').click(function(){
          document.getElementById("save").style.visibility="visible";
        
          $('#password1').attr("readonly",false);
          $('#email1').attr("readonly",false);
          $('#username1').attr("readonly",false);
          $('#phone1').attr("readonly",false);
      })
      $("#save").click(function(){
           var r = confirm("确定修改?");
           if(r==true){
               var account = $('#account1').val();
                var password = $('#password1').val();
                var email = $('#email1').val();
               var username =  $('#username1').val();
                var phone = $('#phone1').val();
            
         var json = {"account":account,"password":password,"email":email,"username":username,"phone":phone}
           
                $.ajax({
                    type:'post',
                    url:"http://127.0.0.1:8080/adminUpdateUser",
                    data: json,
                  
                    contentType: "application/x-www-form-urlencoded",  
                     success:function(){
                    
                            location.reload();
                         },
                         erroe: function(){
                             alert("保存失败！");
                         }
                })
                
           }
        
          
      })
      
  })
  
  </script>
</head>
<body class="fix-header card-no-border">
    <!-- ============================================================== -->
    <!-- Preloader - style you can find in spinners.css -->
    <!-- ============================================================== -->
    <div class="preloader">
        <svg class="circular" viewBox="25 25 50 50">
            <circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10" /> </svg>
    </div>
    <!-- ============================================================== -->
    <!-- Main wrapper - style you can find in pages.scss -->
    <!-- ============================================================== -->
    <div id="main-wrapper">
        <!-- ============================================================== -->
        <!-- Topbar header - style you can find in pages.scss -->
        <!-- ============================================================== -->
        <header class="topbar">
            <nav class="navbar top-navbar navbar-toggleable-sm navbar-light">
                <!-- ============================================================== -->
                <!-- Logo -->
                <!-- ============================================================== -->
                <div class="navbar-header">
                    <a class="navbar-brand" href="table-basic.html">
                        <!-- Logo icon -->
                        <b>
                            <!--You can put here icon as well // <i class="wi wi-sunset"></i> //-->
                            <!-- Dark Logo icon -->
                            <img src="assets/images/logo-icon.png" alt="homepage" class="dark-logo" /> 
                        </b>
                        <!--End Logo icon -->
                        <!-- Logo text -->
                        <span>
                            <!-- dark Logo text -->
                               <img class="dark-logo" />图书后台管理系统
                        </span>
                    </a>
                </div>
                <!-- ============================================================== -->
                <!-- End Logo -->
                <!-- ============================================================== -->
                <div class="navbar-collapse">
                    <!-- ============================================================== -->
                    <!-- toggle and nav items -->
                    <!-- ============================================================== -->
                    <ul class="navbar-nav mr-auto mt-md-0 ">
                        <!-- This is  -->
                        <li class="nav-item"> <a class="nav-link nav-toggler hidden-md-up text-muted waves-effect waves-dark" href="javascript:void(0)"><i class="ti-menu"></i></a> </li>
                        <li class="nav-item hidden-sm-down">
                            <form class="app-search p-l-20">
                                <input type="text" class="form-control" placeholder="近期考试繁忙，此功能请期待下一版本"> <a class="srh-btn"><i class="ti-search"></i></a>
                            </form>
                        </li>
                    </ul>
                    <!-- ============================================================== -->
                    <!-- User profile and search -->
                    <!-- ============================================================== -->
                     <h1>广西科技大学图书管理系统</h1>
                    <ul class="navbar-nav my-lg-0">
                        <li class="nav-item dropdown">
                            <a class="nav-link dropdown-toggle text-muted waves-effect waves-dark" href="" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><img src="assets/images/users/1.jpg" alt="user" class="profile-pic m-r-5" />宇宙无敌可爱帅气管理员</a><a href="#" onclick="quit()">注销</a>
                        </li>
                    </ul>
                </div>
            </nav>
        </header>
        <!-- ============================================================== -->
        <!-- End Topbar header -->
        <!-- ============================================================== -->
        <!-- ============================================================== -->
        <!-- Left Sidebar - style you can find in sidebar.scss  -->
        <!-- ============================================================== -->
        <aside class="left-sidebar">
            <!-- Sidebar scroll-->
            <div class="scroll-sidebar">
                <!-- Sidebar navigation-->
                <nav class="sidebar-nav">
                    <ul id="sidebarnav">
                       <li>
                           <a href="table-basic.html" class="waves-effect"><i class="fa fa-table m-r-10" aria-hidden="true"></i>图书信息</a>
                       </li>
                        <li>
                            <a href="pages-profile.html" class="waves-effect"><i class="fa fa-user m-r-10" aria-hidden="true"></i>个人信息</a>
                        </li>
                       
                        <li>
                            <a href="user-admin.html" class="waves-effect"><i class="fa fa-font m-r-10" aria-hidden="true"></i>用户管理</a>
                        </li>
                        
                        >
                       
                    </ul>
                   
                </nav>
                <!-- End Sidebar navigation -->
            </div>
            <!-- End Sidebar scroll-->
        </aside>
        <!-- ============================================================== -->
        <!-- End Left Sidebar - style you can find in sidebar.scss  -->
        <!-- ============================================================== -->
        <!-- ============================================================== -->
        <!-- Page wrapper  -->
        <!-- ============================================================== -->
        <div class="page-wrapper">
            <!-- ============================================================== -->
            <!-- Container fluid  -->
            <!-- ============================================================== -->
            <div class="container-fluid">
                <!-- ============================================================== -->
                <!-- Bread crumb and right sidebar toggle -->
                <!-- ============================================================== -->
                <div class="card-block">
                    <h4 class="card-title">用户资料</h4>
             <div class="table-responsive">
                 <img src="img/tx2.jpg" style="width: 150px;height: 150px; position: absolute; border: solid;" />
                 
                 <label style="margin-left: 180px;" >账号：</label><input type="text" id="account1" readonly></input>
                <label style="margin-left: 180px;">姓名：</label> <input type="text" id="username1" readonly></input><br />
               <label style="margin-left: 180px;"> 密码：</label> <input type="password" id="password1"  readonly></input>
               <label style="margin-left: 180px;">邮箱：</label>  <input type="text" id="email1" readonly></input><br />
               <label style="margin-left: 180px;">电话：</label>  <input type="text" id="phone1" readonly></input><br />
                 <button id="updata"style="margin-left: 180px;" >修改</button>
                 <button id="save" style="visibility: hidden;">保存</button>
                 <hr />
                 
                 <table class="table">
                     <thead>
                         <tr>
                           
                             <th id="book_name">已借书籍</th>
                             <th id="date_borrow">借书日期</th>
                             <th id="date_return">到期日期</th>
                             <th></th>
                         </tr>
                     </thead>
                     <tbody id="table1">
                         
                     </tbody>
                 </table>
             </div>
                    </div>
                </div>
                <!-- ============================================================== -->
                <!-- End Bread crumb and right sidebar toggle -->
                <!-- ============================================================== -->
                <!-- ============================================================== -->
                <!-- Start Page Content -->
                <!-- ============================================================== -->
               
        <!-- ============================================================== -->
        <!-- End Page wrapper  -->
        <!-- ============================================================== -->
    </div>
    </div>
    <!-- ============================================================== -->
    <!-- End Wrapper -->
    <!-- ============================================================== -->
    <!-- ============================================================== -->
    <!-- All Jquery -->
    <!-- ============================================================== -->
    <script src="assets/plugins/jquery/jquery.min.js"></script>
    <!-- Bootstrap tether Core JavaScript -->
    <script src="assets/plugins/bootstrap/js/tether.min.js"></script>
    <script src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>
    <!-- slimscrollbar scrollbar JavaScript -->
    <script src="js/jquery.slimscroll.js"></script>
    <!--Wave Effects -->
    <script src="js/waves.js"></script>
    <!--Menu sidebar -->
    <script src="js/sidebarmenu.js"></script>
    <!--stickey kit -->
    <script src="assets/plugins/sticky-kit-master/dist/sticky-kit.min.js"></script>
    <!--Custom JavaScript -->
    <script src="js/custom.min.js"></script>
    <!-- ============================================================== -->
    <!-- Style switcher -->
    <!-- ============================================================== -->
    <script src="assets/plugins/styleswitcher/jQuery.style.switcher.js"></script>
</body>

</html>
